Apache Velocity

Apache Velocity
Developer(s) Apache Software Foundation
Stable release 1.7 / November 29, 2010; 14 months ago (2010-11-29)
Development status Active
Written in Java
Operating system Cross-platform
Type template engine
License Apache License 2.0
Website http://velocity.apache.org/

Apache Velocity (formerly known as Jakarta Velocity) is an open source software project directed by the Apache Software Foundation. Velocity is a Java-based template engine that provides a simple yet powerful template language to reference objects defined in Java code. Its aim is to ensure clean separation between the presentation tier and business tiers in a Web application (the model–view–controller design pattern).

Velocity is not widely used. Most developers seeking a product for this task are more likely to use the far better-known XSLT. One of the few places where Velocity is used is as part of Apache's Torque project, a tool for single-source publishing of database objects and schemas across different database platforms. Single XML and DTD documents are written to describe the database, then a suite of different Velocity templates for each target database are used to expand these into the necessary SQL statemnts.

Contents

Uses

Some common types of applications that use Velocity are:

Code example

The following template:

## Velocity Hello World
<html>
    <body>
       #set( $foo = "Velocity" )
       ## followed by
       Hello $foo World!
    </body>
</html>

processed by Velocity will produce the following text:

<html>
    <body>
     Hello Velocity World!
    </body>
</html>

The syntax and overall concept of the Apache Velocity templates is very similar to the syntax of the older WebMacro template engine which is now also an open source project.

See also

References

  1. ^ "PoweredByVelocity". Velocity Wiki. Wiki.apache.org. 2009-12-30. http://wiki.apache.org/velocity/PoweredByVelocity. Retrieved 2010-03-29. 

Bibliography

External links